apps = shm_server   client   fb_data

all: $(apps)

PUBLIC_INCLUDE = /home/projects/gocode/process_shm/interface
JPG_INCLUDE = /home/projects/gocode/local/include
JPG_LIB = /home/projects/gocode/local/lib

INCLUDES += -I./ -I$(PUBLIC_INCLUDE) -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(JPG_INCLUDE)

C_FLAGS += -Wall


LIBS += -lpthread -L$(JPG_LIB)  -ljpeg

LD = $(MVTOOL_PREFIX)gcc 
CC = $(MVTOOL_PREFIX)gcc $(INCLUDES) $(C_FLAGS) -c
AR = $(MVTOOL_PREFIX)ar

sh_obj = interface/ipc.o interface/request.o  interface/media_request.o 

shm_obj = server/server.o server/frame.o  server/input/file_input.o  
shm_obj += $(sh_obj)


app_obj = client.o 
app_obj += $(sh_obj)





#%.o:%.c 
#	$(CC) -o $@ $< 

shm_server : $(shm_obj)
	$(LD) -o $@  $(shm_obj)  $(LIBS) 

server/server.o : server/server.c 
	$(CC) $(C_FLAGS) -o $@ $<	$(LIBS)

server/frame.o : server/frame.c 
	$(CC) $(C_FLAGS) -o $@ $<
	
interface/msg_util.o : interface/msg_util.c 
	$(CC) $(C_FLAGS) -o $@ $<
	
interface/shm.o : interface/shm.c 
	$(CC) $(C_FLAGS) -o $@ $<	
	
interface/ipc.o : interface/ipc.c 
	$(CC) $(C_FLAGS) -o $@ $<	

input/file_input.o : input/file_input.c 
	$(CC) $(C_FLAGS) -o $@ $<	


client: $(app_obj)
	$(LD) $(C_FLAGS) -o $@ $(app_obj) 
	
fb_data: server/input/fb_input.o 
		$(LD) -o $@  $<  $(LIBS) 

fb_input.o : fb_input.c 
	$(CC) $(C_FLAGS) -o $@ $< 	
	
interface/request.o : interface/request.c 
	$(CC) $(C_FLAGS) -o $@ $<		
	
interface/media_request.o : interface/media_request.c 
	$(CC) $(C_FLAGS) -o $@ $<	
	
	
client.o : client.c 
	$(CC) $(C_FLAGS) -o $@ $< 


	
clean:
	-$(RM) -f $(apps)
	-$(RM) -f $(shm_obj) $(app_obj) $(sh_obj)
	-$(RM) -f *.o






